<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册页面</title>
   <link rel="stylesheet" href="../css/02.css">
</head>
<body>
<h1 style="text-align: center;color: #0099cc">注册</h1>
<div class="main">
    <form action="${pageContext.request.contextPath}/user/register" method="post">
        账号:
        <input name="username" type="text" placeholder="请输入用户名">
        <br>
        密码:
        <input name="password" id="pw" type="password" placeholder="请输入密码">
        <br>
        密码:
        <input type="password" id="repw" placeholder="请确认您的密码" onkeyup="checkpassword()">
        <span id="tishi"></span></input>
        <br>
        <input id="btn" type="submit" value="注册">
        <br>
        <span style="color: red">${REGISTER_MSG}</span>
        <a href="${pageContext.request.contextPath}/pages/login.jsp">去登录</a>
    </form>


    <script type="text/javascript">
        function checkpassword() {
            let password = document.getElementById("pw").value;
            let repassword = document.getElementById("repw").value;

            if(password == repassword) {
                document.getElementById("tishi").innerHTML="<br><font color='green'>两次密码输入一致</font>";
                document.getElementById("btn").disabled = false;

            }else {
                document.getElementById("tishi").innerHTML="<br><font color='red'>两次输入密码不一致!</font>";
                document.getElementById("btn").disabled = true;
            }
        }
    </script>

</div>

</body>
</html>
